<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>库存管理管理</title>
	<meta name="decorator" content="default"/>

    <style type="text/css">
        #span1{color: red; font-size: 12px;}
    </style>

	<style type="text/css">
		#span2{color: red; font-size: 12px;}
	</style>

    <script type="text/javascript">
		$(document).ready(function() {
			//$("#name").focus();
			$("#btnSubmit").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
	</script>

	<script type="text/javascript">
		function chage() {
			if(!($("#che").get(0).checked)){
				$("#timeDay").hide();
				$("#timeYear").show();
			}else{
				$("#timeDay").show();
				$("#timeYear").hide();
			}
		}
		function chage01() {
			if(!($("#che01").get(0).checked)){
				$("#timeDay").hide();
				$("#timeYear").show();
			}else{
				$("#timeDay").show();
				$("#timeYear").hide();
			}
		}
		function chage02() {
			if(!($("#che01").get(0).checked)){
				$("#timeDay").hide();
				$("#timeYear").show();
			}else{
				$("#timeDay").show();
				$("#timeYear").hide();
			}
		}
		/*$(function(){
			$("#btnSubmit").click(function(){
				var pretime = $("#pretime").val();
				var endtime = $("#endtime").val();
				var pre =/^(\d{1,4}).(\d{1,2}).(\d{1,2}) (\d{1,2}):(\d{1,2})$/;
                var end =/^(\d{1,2}):(\d{1,2})$/;
				if(!($("#che").get(0).checked)){
					if(!pre.test(pretime)) {
						var x=document.getElementById("span1");//这里是向body的<span id="spa"></span>中插内容
						x.innerHTML="请输入正确的格式：yyyy.MM.dd HH:mm";
						return false;
					}
					if(!pre.test(endtime)) {
						var x=document.getElementById("span2");//这里是向body的<span id="spa"></span>中插内容
						x.innerHTML="请输入正确的格式：yyyy.MM.dd HH:mm";
						return false;
					}
                    $("#inputForm").submit();
				}else{
					if(!end.test(pretime)) {
						var x=document.getElementById("span1");//这里是向body的<span id="spa"></span>中插内容
						x.innerHTML="请输入正确的格式：HH:mm";
						return false;
					}
					if(!end.test(endtime)) {
						var x=document.getElementById("#span2");//这里是向body的<span id="spa"></span>中插内容
						x.innerHTML="请输入正确的格式：HH:mm";
						return false;
					}
					$("#inputForm").submit();
				}
			});
		});*/
	</script>
	<style type="text/css">
		.text1{width:500px; height:20px}
	</style>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/sys/tbShopProduct/">库存管理列表</a></li>
		<li class="active"><a href="${ctx}/sys/tbShopProduct/form?id=${tbShopProduct.id}">商品管理${not empty tbShopProduct.id?'修改':'添加'}<shiro:lacksPermission name="sys:tbShopProduct:edit"></shiro:lacksPermission></a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="tbShopProduct" action="${ctx}/sys/tbShopProduct/save" method="post" class="form-horizontal" >
		<form:hidden path="id"/>
		<sys:message content="${message}"/>
		<div class="control-group">
			<label class="control-label">商品名称：</label>
			<div class="controls">
				${tbShopProduct.productName}
			<%--	<form:input path="productName" htmlEscape="false"  class="text1" disabled="true" maxlength="500"/>--%>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">售价：</label>
			<div class="controls">
				<form:input path="price" htmlEscape="false"  min="0"  class="input-xlarge required number"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">库存：</label>
			<div class="controls">
				<form:input path="storeNum" type="number" min="1" htmlEscape="false" maxlength="11" class="input-xlarge  digits"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">库存预警值：</label>
			<div class="controls">
				<form:input path="alertStoreNum" type="number" min="0" htmlEscape="false" maxlength="11" class="input-xlarge  digits"/>
			</div>
		</div>
		<div class="form-actions">
			<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>

</body>
</html>